package com.ithuameng.admin;

import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan(basePackages = {"com.ithuameng.admin"})
@MapperScan({"com.ithuameng.admin.app.*.dao"})
public class AdminApplication {
    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(AdminApplication.class);
        springApplication.setMainApplicationClass(AdminApplication.class);
        springApplication.run(args);
    }

    @Bean
    public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
        return builder -> builder.serializerByType(Long.class, ToStringSerializer.instance);
    }
}
